https://blog.csdn.net/liufengl138/article/details/78932954


emacs   --batch   fp16_mod_ln2.sv           -f verilog-auto     -f save-buffer 	


0

/*autoarg*/
  /*AUTOINPUT*/
  /*AUTOOUTPUT*/
  /*AUTOWIRE*/
    
  /*AUTOINST*/


/*AUTOINSTPARAM*/

always @ (/*AUTOSENSE*/) begin
   outin = ina | inb;
   out = outin;
end



// Local Variables:
// verilog-auto-inst-param-value:t
// verilog-library-directories:("." "../axi"  "../uart" )
// End:





1
.h\(.*\) 		(@"(upcase vl-name)"DMAC1[]),
        .htrans		(HTRANSDMAC1[1:0]), // Templated
        

2
/* aon AUTO_TEMPLATE (
	.H\(.*\) 		(H\1AON[]),
    .\(.*\)_m1 		(mux_dma_\1[]),
	.\(.*\)_s1 		(l2f_\1[]),
	.\(.*\)_s2 		(r2a_\1[]),
    .mem_axi4_0_aw_bits_\(.*\)		(mem_aw\1[]),
 );
 */

        .HRDATA		(HRDATAAON[31:0]),	 // Templated
        
    
3.1
  .m00\(.*\)user(@"(if (equal vl-dir \\"input\\") \\"'d0\\" \\"\\")"),
  .m00\(.*\)user(),

									     .m00_axi_awuser	(),		 // Templated
									     .m00_axi_buser	('d0),		 // Templated
 
3.2
  /* axi_crossbar_wrap_2x1  AUTO_TEMPLATE (
        .m00\(.*\)user (@"(if (equal vl-dir \\"input\\") (concat   \\"{\\"    vl-width   \\"{\\"   \\"1'b0\\"  \\"}\\"   \\"}\\"      ) \\"\\" )"),
        .m00\(.*\)user (@"(if (equal vl-dir \\"output\\")  \\"\\"   \\"\\" )"),
       ); */

									     .m00_axi_awuser	(),		 // Templated
									     .m00_axi_buser	({BUSER_WIDTH{1'b0}}), // Templated
                                           




4  
.H\(.*\)8 			({@"vl-width"{1'b0}}),
        
        .HRESP8		({1{1'b0}}),	 // Templated
        


5.0
/* psm_mas AUTO_TEMPLATE (
        .PTL_MAPVALIDP1X  (PTL_MAPVALID[@"(% (+ 1 @) 4)"]));
*/

submod i0 (/*AUTOINST*/);
submod i1 (/*AUTOINST*/);
submod i2 (/*AUTOINST*/);
submod i3 (/*AUTOINST*/);
    The MAPVALIDP1X example above would put [@+1 modulo 4] into thebrackets. Thus instantiation i0 gets PTL_MAPVALID[1], i1 getsPTL_MAPVALID[2], i2 gets PTL_MAPVALID[3], i3 gets PTL_MAPVALID[0]. (Thecoder picked the port name MAPVALIDP1X to mean MAPVALID plus 1instantiation number.) This type of thing is very useful for barrelshifters and the like.


5.1
/* submod AUTO_TEMPLATE (
      .\(.*[^0-9]\)@  (\1[\2]),
      );*/
                It says to take a port of the form lettersDIGITS and convert it toletters[DIGITS], conveniently vectorizing the signal. The [^0-9] isneeded because otherwise .* could match trailing digits.

.\(.*[^0-9]\)@  (\1[\2]),

.pci_req0   (pci_req[0]),
.pci_req1   (pci_req[1]),
.pci_req2   (pci_req[2]),
.pci_req3   (pci_req[3]),



5.2

/* InstModule AUTO_TEMPLATE (
     .a(in[@"(+ (* 8 @) 7)":@"(* 8 @)"]),
     );*/

InstModule u_a0 (/*AUTOINST*/
                 // Inputs
                 .a                     (in[7:0]));               // Templated
InstModule u_a1 (/*AUTOINST*/
                 // Inputs
                 .a                     (in[15:8]));              // Templated
InstModule u_a2 (/*AUTOINST*/
                 // Inputs
                 .a                     (in[23:16]));             // Templated
InstModule u_a3 (/*AUTOINST*/
                 // Inputs
                 .a                     (in[31:24]));             // Templated




6 
/* InstModule AUTO_TEMPLATE "_\([a-z]+\)" (
		.ptl_mapvalidx		(@_ptl_mapvalid),
		.ptl_mapvalidp1x	(ptl_mapvalid_@),
		);
	*/
	InstModule ms2_FOO (/*AUTOINST*/);
	InstModule ms2_BAR (/*AUTOINST*/);


	InstModule ms2_FOO (/*AUTOINST*/
	    // Outputs
	    .ptl_mapvalidx		(FOO_ptl_mapvalid),
	    .ptl_mapvalidp1x		(ptl_mapvalid_FOO));
	InstModule ms2_BAR (/*AUTOINST*/
	    // Outputs
	    .ptl_mapvalidx		(BAR_ptl_mapvalid),
	    .ptl_mapvalidp1x		(ptl_mapvalid_BAR));
           
7
常用的lisp函数有：
 substring STRING  start  end
 downcase string-or-char
 upcase string-or-char
 capitalize string-or-char   // words 的首字母大写
 store-substring string idx  char     // 用 char 替换 从 idx 开始的 string.   string 长度不变。
